<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<link rel="stylesheet" type="text/css"
	href="${pageContext.request.contextPath }/assets/jquery-easyui-1.4.3/themes/default/easyui.css" />
<link rel="stylesheet" type="text/css"
	href="${pageContext.request.contextPath }/assets/jquery-easyui-1.4.3/themes/icon.css" />
<link rel="stylesheet" type="text/css"
	href="${pageContext.request.contextPath }/assets/css/easyui.icon.css" />
<script type="text/javascript"
	src="${pageContext.request.contextPath }/assets/jquery-easyui-1.4.3/jquery.min.js"></script>
<script type="text/javascript"
	src="${pageContext.request.contextPath }/assets/jquery-easyui-1.4.3/jquery.easyui.min.js"></script>
<script type="text/javascript"
	src="${pageContext.request.contextPath }/assets/jquery-easyui-1.4.3/locale/easyui-lang-zh_CN.js"></script>
<script type="text/javascript"
	src="${pageContext.request.contextPath }/assets/jquery.js/jquery.json.js"></script>
<script type="text/javascript"
	src="${pageContext.request.contextPath }/assets/jquery.js/jquery.fw.ext.js"></script>
<script type="text/javascript"
	src="${pageContext.request.contextPath }/assets/js/jquery.form.js"></script>
<script type="text/javascript"
	src="${pageContext.request.contextPath }/assets/easyui.js/easyui.ext.js"></script>
<script type="text/javascript"
	src="${pageContext.request.contextPath }/assets/easyui.js/easyui.validate.js"></script>
<script type="text/javascript"
	src="${pageContext.request.contextPath }/assets/js/message.js"></script>
<script type="text/javascript"
	src="${pageContext.request.contextPath }/assets/js/MD5.js"></script>
<script type="text/javascript"
	src="${pageContext.request.contextPath }/assets/js/moment.js"></script>
<script type="text/javascript"
	src="${pageContext.request.contextPath }/assets/js/zh-cn.js"></script>
<!-- 頂部 -->
<div id="buycar">
	<div id="load_bg" style="display: none;" onclick="del_div('div#login')"></div>
	<div id="load_bg2" style="display: none;"
		onclick="del_div('div#login')"></div>
	<input type="hidden" id="loginUserId" value="${loginUser.id }" />
	<!-- 頂部列表 -->
	<div id="toplist">
		<div id="topcenter">
			<span> <c:if
					test="${loginUser == null || loginUser.roleProperty == 1}">
					<a href="javascript:void(0)" onclick="add_div('div#login')">加入/登入会员</a>
				</c:if> <c:if test="${loginUser != null && loginUser.roleProperty != 1}">
					<a href="javascript:void(0)"
						style="text-decoration: none; cursor: default;">${loginUser.trueName }，您好！</a>
				</c:if>
			</span>
			<c:if test="${loginUser != null }">
				<span><a href='javascript:void(0)' onclick='logOut()'>退出</a></span>
				<span><a href='javascript:void(0)' onclick='loadUserInfo()'>资料修改</a></span>
			</c:if>
			<span><a href="javascript:void(0)"
				onclick="add_div('div#ShoppingInformation')">会员权益</a></span> <span
				style="float: right;">访问人数:${visitNumber}</span>
			<!-- <span id="carlist" style="border:none">
				            <img src="${pageContext.request.contextPath }/assets/images/buycar.png">
				            <a href="javascript:void(0)">購物車&nbsp;(0)</a>
				        </span> -->
		</div>
	</div>
	<!-- 会员登入 -->
	<div id="login" class="Box Box1" style="left: 42.5%; top: 172.5px;">
		<h1></h1>
		<div class="cont">
			<form id="loginForm" method="post">
				<table width="260" cellspacing="0" border="0">
					<tbody>
						<tr align="center">
							<th width="30" style="color: #000;">帐号</th>
							<td width="230" colspan="2"><input id="userName_login"
								type="text" name="userName" style="width: 165px; color: #000;"></td>
						</tr>
						<tr>
							<td colspan="3" height="10"></td>
						</tr>
						<tr align="center">
							<th style="color: #000;">密码</th>
							<td colspan="2"><input id="password_login" type="password"
								name="password_login" style="width: 165px; color: #000;"><input
								id="hidden_password_login" type="hidden" name="password"></td>
						</tr>
						<tr>
							<td colspan="3" height="10"></td>
						</tr>
						<tr>
							<td rowspan="2"></td>
							<td><img
								src="${pageContext.request.contextPath }/assets/images/LoginBTNa.png"
								style="width: 90px; border: none"
								onclick="send_form_member_login(this.form);" /></td>
							<td><a href="javascript:void(0)"
								onclick="del_div('div#login','div#ForgotPassword')"><img
									src="${pageContext.request.contextPath }/assets/images/LoginBTN01a.png"></a></td>
						</tr>
						<tr>
							<td><a href="javascript:void(0)"
								onclick="del_div('div#login','div#Joinus');get_page_member_read()"><img
									src="${pageContext.request.contextPath }/assets/images/FirstBTN.png"></a></td>
							<td><a href="javascript:void(0)"
								onclick="del_div('div#login')"><img
									src="${pageContext.request.contextPath }/assets/images/LoginBTN03a.png"></a></td>
						</tr>
					</tbody>
				</table>
			</form>
		</div>
		<div class="Boxbtm"></div>
	</div>
	<!-- 提示窗口 -->
	<div id="infoBox" class="Box Box1"
		style="display: none; left: 42.5%; top: 228.5px;">
		<h1></h1>
		<div class="cont" style="height: auto; overflow: hidden;">
			<div class="info">内容未填写完整!</div>
			<div class="agree_btn">
				<input id="info_box" type="image"
					src="${pageContext.request.contextPath }/assets/images/OK.png"
					onclick="info_box()">
			</div>
		</div>
		<div class="Boxbtm"></div>
	</div>
	<!-- 提示窗口 -->
	<div id="ShoppingInformation" class="Box Box1"
		style="display: none; left: 42.5%; top: 228.5px;">
		<h3></h3>
		<!-- <h1></h1> -->
		<div class="cont" style="height: auto; overflow: hidden;">
			<div class="info"
				style="text-align: center; width: 250px; font-size: 14px; font-weight: bold; margin-top: 0px;">会员权益</div>
			<div>MIO美爱我氧气站将不定时推出活动，加入MIO美爱我氧气站官网会员，即可享有参加MIO美爱我氧气站所举办的活动优先权，有机会领取小礼物喔~~~</div>
			<div style="text-align: right;">服务时间：周一至周五9:00-17:00例假日除外</div>
			<div class="agree_btn">
				<input id="info_box" type="image"
					src="${pageContext.request.contextPath }/assets/images/OK.png"
					onclick="ShoppingInformation_box()">
			</div>
		</div>
		<div class="Boxbtm"></div>
	</div>
	<!-- 忘记密码 -->
	<div id="ForgotPassword" class="Box Box2"
		style="display: none; left: 32%; top: 23.5px;">
		<h1>
			<div class="Xbtn">
				<a href="javascript:void(0)" title="关闭窗口"
					onclick="del_div('div#ForgotPassword')"></a>
			</div>
		</h1>
		<div class="cont">
			<form id="forgetForm" method="post">
				<div class="info">
					<table border="0" cellspacing="0" width="600">
						<tbody>
							<tr>
								<th width="120"><font>*</font>&nbsp;帐号：</th>
								<td width="480"><input name="userName" value=""
									class="textbox easyui-validatebox" required="true"
									style="color: #000;"></td>
							</tr>
							<tr>
								<th><font>*</font>&nbsp;电子邮箱：</th>
								<td><input name="email" value=""
									class="textbox easyui-validatebox" required="true"
									data-options="validType:'email'" style="color: #000;"></td>
							</tr>
						</tbody>
					</table>
					<p class="agree_P">*&nbsp;号为必填内容</p>
				</div>
				<div class="agree_btn">
					<input type="image"
						src="${pageContext.request.contextPath }/assets/images/ForgotPasswordBTN01a.png"
						onclick="send_form_member_forget(this.form);return false;">
					<input type="image"
						src="${pageContext.request.contextPath }/assets/images/ForgotPasswordBTN02a.png"
						onclick="$(this.form).resetForm();return false;">
				</div>
			</form>
		</div>
		<div class="Boxbtm"></div>
	</div>
	<!-- 加入会员 -->
	<div id="Joinus" class="Box Box2"
		style="display: none; left: 32%; top: 23.5px;">
		<h1>
			<div class="Xbtn">
				<a href="javascript:void(0)" title="关闭窗口"
					onclick="del_div('div#Joinus')"></a>
			</div>
		</h1>
		<div class="cont">
			<form id="joinUsForm" method="post">
				<div class="info">
					<!-- <h3><img src="http://www.elizecosmo.com.tw/system/media/img/buycar/3/ShoppingInformation_img01-2.png" width="500"></h3> -->
					<table width="600" border="0" cellspacing="0">
						<tbody>
							<tr>
								<th width="120"><font>*</font>&nbsp;帐号</th>
								<td width="480"><input id="joinUserName" name="userName"
									value="" class="textbox easyui-validatebox" required="true"
									validType="length[6,20]" type="text" style="color: #000;"><span
									style="color: #000;">&nbsp;(请填入6至20个字元的英文字母、数字)</span></td>
							</tr>
							<tr>
								<th><font>*</font>&nbsp;密码</th>
								<td><input id="joinPassword" name="password"
									class="textbox easyui-validatebox" required="true"
									validType="length[6,20]" type="password" style="color: #000;"><span
									style="color: #000;">&nbsp;(请填入6至20个字元的英文字母、数字)</span></td>
							</tr>
							<tr>
								<th><font>*</font>&nbsp;密码确认</th>
								<td><input id="joinPassword_again" name="password_again"
									class="textbox easyui-validatebox" required="true"
									type="password" style="color: #000;"><span
									id="error_pwd" style="color: red; display: none;">&nbsp;密码和确认密码不相符，请重新输入！！!</span></td>
							</tr>
							<tr>
								<th><font>*</font>&nbsp;真实姓名</th>
								<td><input name="trueName" value=""
									class="textbox easyui-validatebox" required="true" type="text"
									style="color: #000;"></td>
							</tr>
							<tr>
								<th><font>*</font>&nbsp;&nbsp;&nbsp;出生日期</th>
								<td><input name="year" value="" maxlength="4" size="4"
									class="textbox easyui-validatebox" required="true"
									data-options="validType:'integer'"
									data-options="validType:'floatOrInt'" style="color: #000;"><span
									style="color: #000;">&nbsp;年&nbsp;</span> <input name="month"
									value="" maxlength="2" size="2"
									class="textbox easyui-validatebox" required="true"
									data-options="validType:'integer'"
									data-options="validType:'floatOrInt'" style="color: #000;"><span
									style="color: #000;">&nbsp;月&nbsp;</span> <input name="day"
									value="" maxlength="2" size="2"
									class="textbox easyui-validatebox" required="true"
									data-options="validType:'integer'"
									data-options="validType:'floatOrInt'" style="color: #000;"><span
									style="color: #000;">&nbsp;日</span></td>
							</tr>
							<tr>
								<th><font>*</font>&nbsp;&nbsp;&nbsp;性別</th>
								<td><input name="sex" value="1" checked="checked"
									type="radio" style="color: #000;"><span
									style="color: #000;">&nbsp;男&nbsp;</span> <input name="sex"
									value="0" type="radio" style="color: #000;"><span
									style="color: #000;">&nbsp;女</span></td>
							</tr>
							<tr>
								<th><font>*</font>&nbsp;手机</th>
								<td><input class="textbox easyui-validatebox"
									required="true" data-options="validType:'mobile'"
									name="mobilePhone" value="" type="text" style="color: #000;"></td>
							</tr>
							<tr>
								<th><font>*</font>&nbsp;住址</th>
								<td><input class="textbox easyui-validatebox"
									required="true" name="address" value="" type="text"
									style="width: 400px; color: #000;"></td>
							</tr>
							<tr>
								<th><font>*</font>&nbsp;邮箱</th>
								<td><input name="email" value=""
									class="textbox easyui-validatebox" required="true"
									data-options="validType:'email'" type="text"
									style="width: 400px; color: #000;"></td>
							</tr>
						</tbody>
					</table>
					<p class="agree_P">*&nbsp;号为必填栏目</p>
				</div>
				<div class="agree_btn">
					<input type="image"
						src="${pageContext.request.contextPath }/assets/images/OK.png"
						onclick="send_form_member_add_check(this.form)"> <input
						type="image"
						src="${pageContext.request.contextPath }/assets/images/JoinusBTN04a.png"
						onclick="$(this.form).resetForm();return false;">
				</div>
			</form>
		</div>
		<div class="Boxbtm"></div>
	</div>
	<!-- 修改会员信息 -->
	<div id="modifyUserInfo" class="Box Box2"
		style="display: none; left: 32%; top: 23.5px;">
		<h1>
			<div class="Xbtn">
				<a href="javascript:void(0)" title="关闭窗口"
					onclick="del_div('div#modifyUserInfo')"></a>
			</div>
		</h1>
		<div class="cont">
			<form id="modifyUserInfoForm" method="post">
				<div class="info">
					<!-- <h3><img src="http://www.elizecosmo.com.tw/system/media/img/buycar/3/ShoppingInformation_img01-2.png" width="500"></h3> -->
					<table width="600" border="0" cellspacing="0">
						<tbody>
							<tr>
								<th width="120"><font>*</font>&nbsp;帐号</th>
								<td width="480"><input name="userName" value=""
									class="textbox easyui-validatebox" readonly
									style="background: #ccc;" required="true"
									validType="length[6,20]" type="text" style="color:#000;">
									<span style="color: #000;">&nbsp;(请填入6至20个字元的英文字母、数字)</span> <input
									name="id" value="" type="hidden" /></td>
							</tr>
							<tr>
								<th><font>*</font>&nbsp;密码</th>
								<td><input name="password"
									class="textbox easyui-validatebox" required="true"
									validType="length[6,20]" type="password" style="color: #000;">
									<span style="color: #000;">&nbsp;(请填入6至20个字元的英文字母、数字)</span> <input
									name="hidden-password" type="hidden" /></td>
							</tr>
							<tr>
								<th><font>*</font>&nbsp;密码确认</th>
								<td><input name="password_again"
									class="textbox easyui-validatebox" required="true"
									type="password" style="color: #000;"><span
									id="error_pwd" style="color: red; display: none;">&nbsp;密码和确认密码不相符，请重新输入！！!</span></td>
							</tr>
							<tr>
								<th><font>*</font>&nbsp;真实姓名</th>
								<td><input name="trueName" value=""
									class="textbox easyui-validatebox" required="true" type="text"
									style="color: #000;"></td>
							</tr>
							<tr>
								<th><font>*</font>&nbsp;&nbsp;&nbsp;出生日期</th>
								<td><input name="year" value="" maxlength="4" size="4"
									class="textbox easyui-validatebox" required="true"
									data-options="validType:'integer'"
									data-options="validType:'floatOrInt'" style="color: #000;"><span
									style="color: #000;">&nbsp;年&nbsp;</span> <input name="month"
									value="" maxlength="2" size="2"
									class="textbox easyui-validatebox" required="true"
									data-options="validType:'integer'"
									data-options="validType:'floatOrInt'" style="color: #000;"><span
									style="color: #000;">&nbsp;月&nbsp;</span> <input name="day"
									value="" maxlength="2" size="2"
									class="textbox easyui-validatebox" required="true"
									data-options="validType:'integer'"
									data-options="validType:'floatOrInt'" style="color: #000;"><span
									style="color: #000;">&nbsp;日</span></td>
							</tr>
							<tr>
								<th><font>*</font>&nbsp;&nbsp;&nbsp;性別</th>
								<td><input name="sex" value="1" checked="checked"
									type="radio" style="color: #000;"><span
									style="color: #000;">&nbsp;男&nbsp;</span> <input name="sex"
									value="0" type="radio" style="color: #000;"><span
									style="color: #000;">&nbsp;女</span></td>
							</tr>
							<tr>
								<th><font>*</font>&nbsp;手机</th>
								<td><input class="textbox easyui-validatebox"
									required="true" data-options="validType:'mobile'"
									name="mobilePhone" value="" type="text" style="color: #000;"></td>
							</tr>
							<tr>
								<th><font>*</font>&nbsp;住址</th>
								<td><input class="textbox easyui-validatebox"
									required="true" name="address" value="" type="text"
									style="width: 400px; color: #000;"></td>
							</tr>
							<tr>
								<th><font>*</font>&nbsp;邮箱</th>
								<td><input name="email" value=""
									class="textbox easyui-validatebox" required="true"
									data-options="validType:'email'" type="text"
									style="width: 400px; color: #000;"></td>
							</tr>
						</tbody>
					</table>
					<p class="agree_P">*&nbsp;号为必填栏目</p>
				</div>
				<div class="agree_btn">
					<input type="image"
						src="${pageContext.request.contextPath }/assets/images/OK.png"
						onclick="send_form_modify_userInfo();return false;"> <input
						type="image"
						src="${pageContext.request.contextPath }/assets/images/DatamodificationBTN02a.png"
						onclick="del_div('div#modifyUserInfo');return false;">
				</div>
			</form>
		</div>
		<div class="Boxbtm"></div>
	</div>

</div>
<div id="bg">
	<div class="center">
		<div id="header">
			<h1></h1>
			<div class="logo2">
				<a href="${pageContext.request.contextPath }/index.do"> <img
					src="${pageContext.request.contextPath }/assets/images/mio.png"
					height="55px;" style="">
				</a>
			</div>
			<div class="top_menu2">
				<div class="m1">
					<a href="${pageContext.request.contextPath }/aboutUs.do"
						style="width: 160px;"> <span>About Us</span>关于「美爱我」
					</a>
				</div>
				<div class="m2">
					<a href="${pageContext.request.contextPath }/message.do"> <span>News</span>最新消息
					</a>
				</div>
				<div class="m3">
					<a href="${pageContext.request.contextPath }/recommand.do"> <span>Recommend</span>美美推荐
					</a>
				</div>
				<div class="m4">
					<a href="${pageContext.request.contextPath }/product.do"> <span>Product</span>产品介绍
					</a>
				</div>
				<div class="m5">
					<a href="${pageContext.request.contextPath }/sellNetwork.do"> <span>Network</span>销售网络
					</a>
				</div>
			</div>
		</div>
	</div>
</div>
<script type="text/javascript">
	function add_div(str) {
		$(str).css({
			"display" : "block"
		});
		$("#load_bg").css({
			"display" : "block"
		})
	}
	function del_div(str, next) {
		$(str).css({
			"display" : "none"
		});

		if (next) {
			$(next).css({
				"display" : "block"
			})
		} else {
			$("#load_bg").css({
				"display" : "none"
			})
			$("#login input").val("");
		}
	}
	//会员登入
	function send_form_member_login(form) {

		if ($('#password_login').val() != ""
				&& $("#userName_login").val() != "") {
			//$(form).submit(function(){
			var name = $("#userName_login").val();
			$
					.getJSON(
							"${pageContext.request.contextPath}/user/listAllUser.do",
							{
								userNameSch : name
							},
							function(resultUser) {
								if (resultUser.rows.length > 0) {
									//var rowid=resultUser.rows[0].id;
									$('#hidden_password_login').val(
											faultylabs.MD5($.trim($(
													'#password_login').val())));
									$
											.post(
													"${pageContext.request.contextPath}/user/login.do",
													fw
															.serializeObject($('#loginForm')),
													function(result) {
														$('#password_login')
																.val("");
														$(
																'#hidden_password_login')
																.val("");
														if (result.success) {
															del_div('div#Joinus');
															$("#infoBox .info")
																	.html(
																			"登录成功！！！");
															$("#login")
																	.css(
																			{
																				"display" : "none"
																			});
															$("#infoBox")
																	.css(
																			{
																				"display" : "block"
																			});
															$("#load_bg")
																	.css(
																			{
																				"display" : "none"
																			});
															$("#load_bg2")
																	.css(
																			{
																				"display" : "block"
																			})

															$(
																	$(
																			"#topcenter span a")
																			.get(
																					0))
																	.remove();
															$(
																	$(
																			"#topcenter span")
																			.get(
																					0))
																	.append(
																			"<a href='javascript:void(0)' onclick='' style='text-decoration:none; cursor:default;' >"
																					+ result.info.trueName
																					+ "，您好！</a>");
															$(
																	$(
																			"#topcenter span")
																			.get(
																					0))
																	.after(
																			"<span><a href='javascript:void(0)' onclick='logOut()' >退出</a></span>");
															$(
																	$(
																			"#topcenter span")
																			.get(
																					1))
																	.after(
																			"<span><a href='javascript:void(0)' onclick='loadUserInfo()' >资料修改</a></span>");
															$("#login input")
																	.val("");
															$("#loginUserId")
																	.val(
																			result.info.id);
														} else {
															$("#infoBox .info")
																	.html(
																			"密码错误,请重新输入！！！");
															$("#infoBox")
																	.css(
																			{
																				"display" : "block"
																			});
															$("#load_bg")
																	.css(
																			{
																				"display" : "block"
																			});
														}

													}, 'json');
								} else {
									$("#infoBox .info").html(
											"用户名不存在，请确认后重新输入！！！");
									$("#infoBox").css({
										"display" : "block"
									});
									$('#password_login').val("");
								}
							});
			// });
		} else {
			$("#infoBox .info").html("内容未填写完整!");
			$("#infoBox").css({
				"display" : "block"
			});
			$("#login").css({
				"z-index" : 499
			});
			/*
			$(form).submit(function(){
				return false;
			});*/
		}
	}
	function info_box() {
		$("#infoBox").css({
			"display" : "none"
		});

		$("#login").css({
			"z-index" : 1000
		});
		$("#ForgotPassword").css({
			"z-index" : 1000
		});
		$("#load_bg2").css({
			"display" : "none"
		})
	}
	function ShoppingInformation_box() {
		$("#ShoppingInformation").css({
			"display" : "none"
		});
		$("#load_bg").css({
			"display" : "none"
		})
	}
	function get_page_member_read() {
		$("#Joinus").css({
			"display" : "block"
		})
	}

	function send_form_member_add_check() {

	}

	//发送找回密码请求
	function send_form_member_forget() {
		if ($('#forgetForm').form('validate')) {
			$("#ForgotPassword").css({
				"z-index" : 499
			});
			$.post("${pageContext.request.contextPath}/user/forgetPwd.do", fw
					.serializeObject($('#forgetForm')), function(result) {
				if (result.success) {
					$("#infoBox .info").html("邮件发送成功，请前往邮箱查看！！！");
					$("#infoBox").css({
						"display" : "block"
					});
					$("#load_bg").css({
						"display" : "block"
					})
				} else {
					$("#infoBox .info").html("邮件发送失败，请确认邮箱是否填写正确！！！");
					$("#infoBox").css({
						"display" : "block"
					});
					$("#load_bg").css({
						"display" : "block"
					})
				}
				$('#forgetForm input').val("");
			}, 'json');
		}
	}

	//会员注册
	$("#joinUsForm")
			.submit(
					function() {
						if ($('#joinUsForm').form('validate')) {
							if ($("#joinPassword").val() != $(
									"#joinPassword_again").val()) {
								$("#infoBox .info").html("密码和确认密码不相同，请重新输入！！！");
								$("#infoBox").css({
									"display" : "block"
								});
								return false;
							}
							var name = $("#joinUserName").val();
							$
									.getJSON(
											"${pageContext.request.contextPath}/user/listAllUser.do",
											{
												userNameSch : name,
											},
											function(resultUser) {
												if (resultUser.rows.length > 0) {
													//var rowid=resultUser.rows[0].id;
													$("#infoBox .info").html(
															"用户名已存在，请重新输入！！！");
													$("#infoBox").css({
														"display" : "block"
													});
													return false;
												}
												$('#joinPassword')
														.val(
																faultylabs
																		.MD5($
																				.trim($(
																						'#joinPassword')
																						.val())));
												$
														.post(
																"${pageContext.request.contextPath}/user/addUser.do",
																fw
																		.serializeObject($('#joinUsForm')),
																function(result) {
																	$("#login")
																			.css(
																					{
																						"z-index" : 499
																					});
																	if (result.success) {
																		del_div('div#Joinus');
																		$(
																				"#infoBox .info")
																				.html(
																						"注册成功！！！");
																		$(
																				"#infoBox")
																				.css(
																						{
																							"display" : "block"
																						});
																		$(
																				"#load_bg2")
																				.css(
																						{
																							"display" : "block"
																						})
																	} else {
																		$(
																				"#infoBox .info")
																				.html(
																						"注册失败！！！");
																		$(
																				"#infoBox")
																				.css(
																						{
																							"display" : "block"
																						});
																		$(
																				"#load_bg")
																				.css(
																						{
																							"display" : "block"
																						})
																	}
																	$(
																			'#joinPassword')
																			.val(
																					"");
																}, 'json');

											});
							return false;
						}
						return false;
					});
	//修改用户信息
	function send_form_modify_userInfo() {
		if ($("#modifyUserInfo input[name='password']").val() == $(
				"#modifyUserInfo input[name='password_again']").val()) {
			var userPwd = $("#modifyUserInfo input[name='hidden-password']")
					.val();
			if (userPwd.indexOf($.trim($(
					"#modifyUserInfo input[name='password']").val())) == 0) {
				$("#modifyUserInfo input[name='password']").val(userPwd);
				//说明没有改动密码 
			} else {
				$("#modifyUserInfo input[name='password']")
						.val(
								faultylabs
										.MD5($
												.trim($(
														"#modifyUserInfo input[name='password']")
														.val())));
			}
			//修改
			$.post("${pageContext.request.contextPath}/user/updateUser.do", fw
					.serializeObject($('#modifyUserInfoForm')),
					function(result) {
						console.log(result);
						if (result.success) {
							del_div('div#modifyUserInfo');
							$("#infoBox .info").html("修改用户信息成功！！！");
							$("#infoBox").css({
								"display" : "block"
							});
							$("#load_bg2").css({
								"display" : "block"
							})
						} else {
							$("#infoBox .info").html("修改用户信息失败！！！");
							$("#infoBox").css({
								"display" : "block"
							});
							$("#load_bg").css({
								"display" : "block"
							})
						}
					}, 'json');
		} else {
			$("#infoBox .info").html("密码和确认密码不相同，请重新输入！！！");
			$("#infoBox").css({
				"display" : "block"
			});
		}
	}
	//读取用户信息
	function loadUserInfo() {
		var id = $("#loginUserId").val();
		$.post("${pageContext.request.contextPath}/user/getUserById.do", {
			id : id
		}, function(data) {
			var data = JSON.parse(data);
			$("#modifyUserInfo input[name='id']").val(data.id);
			$("#modifyUserInfo input[name='userName']").val(data.userName);
			//记录原始密码
			$("#modifyUserInfo input[name='hidden-password']").val(
					data.password);
			$("#modifyUserInfo input[name='password']").val(
					data.password.substring(0, 6));
			$("#modifyUserInfo input[name='password_again']").val(
					$("#modifyUserInfo input[name='password']").val());
			$("#modifyUserInfo input[name='trueName']").val(data.trueName);
			$("#modifyUserInfo input[name='mobilePhone']")
					.val(data.mobilePhone);
			$("#modifyUserInfo input[name='address']").val(data.address);
			$("#modifyUserInfo input[name='email']").val(data.email);
			$("#modifyUserInfo input[name='sex'][value=" + data.sex + "]")
					.attr("checked", 'checked');
			var birthday = data.birthday.split(".");
			$("#modifyUserInfo input[name='year']").val(birthday[0]);
			$("#modifyUserInfo input[name='month']").val(birthday[1]);
			$("#modifyUserInfo input[name='day']").val(birthday[2]);
			$('#modifyUserInfoForm').form('validate');
		});
		add_div("div#modifyUserInfo");
	}
	function logOut() {
		$.post("${pageContext.request.contextPath}/user/loginOut.do", {},
				function(data) {
					location.href = "${pageContext.request.contextPath}";
				});
		//location.href="${pageCotext.request.contextPath}";

		//$($("#topcenter span a").get(0)).remove();
		//$($("#topcenter span").get(0)).append("<a href='javascript:void(0)' onclick='add_div(\"div#login\")'>加入/登入会员 </a>");
		//$($("#topcenter span").get(1)).remove();

	}
</script>